<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 4] 4.4 Deprecated Features</TITLE>
<META NAME="author" CONTENT="David Flanagan">
<META NAME="date" CONTENT="Thu Jul 31 15:51:07 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java in a Nutshell">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java in a Nutshell" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch04_03.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 4<br>What's New in Java 1.1</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch04_05.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JNUT2-CH-4-SECT-4">4.4 Deprecated Features</A></h2>

<P CLASS=para>
Although you can use the old AWT event model in Java 1.1, it
has been officially "deprecated," and its use in new
software is discouraged.  When you compile code that uses
the 1.0 event model, you'll be made aware of this by the
"deprecation warning" that the <I CLASS=emphasis>javac</I> compiler issues.
This warning notifies you that your code relies on methods
or classes in the Java API that have been superseded by
newer, preferred alternatives.  If you compile using the
<tt CLASS=literal>-deprecation</tt> flag, <I CLASS=emphasis>javac</I> provides a detailed
warning about each use of a deprecated feature.  You can
simply ignore these warnings, but when time permits, the
better approach is to update your code so that it no longer
relies on deprecated features of the Java API. While it is
not strictly true to say that deprecated features are
"unsupported," they will almost certainly receive far less
support in practice than the features that replace them.

<P CLASS=para>
The reason that the compiler is able to issue deprecation
warnings at all is the addition of a new <tt CLASS=literal>@deprecated</tt>
tag to the documentation-comment syntax of Java 1.1.  As you
may be aware, comments that begin with the <tt CLASS=literal>/**</tt>
character sequence are treated specially in Java, and are
used by the <I CLASS=emphasis>javadoc</I> tool to automatically generate
online documentation for packages, classes, methods, and
fields.  Prior to Java 1.1, the compiler ignored the
contents of documentation comments.  In Java 1.1, however,
it scans these comments for the <tt CLASS=literal>@deprecated</tt> tag.
If it is found, the compiler marks the class, interface,
constructor, method, or field following the comment as
deprecated, and issues a warning when the deprecated feature
is used.

<P CLASS=para>
The old AWT event-handling model is not the only Java 1.0
feature that has been deprecated in Java 1.1; merely the one
you are most likely to encounter first.  A number of common
AWT component methods have been renamed, to follow a more
regular naming scheme that fits the JavaBeans naming
conventions.  These methods can be invoked by the old name
or the new, but if you use the old name, you'll be rewarded
with a deprecation warning. Fortunately, in simple cases
like this, it is trivial to write a script or program to
mechanically convert from the old name to the new.  Other
areas of the Java API have been deprecated as well.  You'll
notice that a few of the input and output stream classes
in the <tt CLASS=literal>java.io</tt> package have been deprecated and
superseded by "Reader" and "Writer" stream classes, for
example.

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch04_03.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch04_05.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>The New AWT Event Model</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>Other AWT Improvements</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
